/** 
 * 项目网关API
 * Author:      cn2008tv 
 * CreateTime:  2023/5/14 20:22:55 
 * LastEditor:  cn2008tv 
 * ModifyTime:  2023/12/5 20:23:10 
 * Description: 
*/ 
import { defHttp } from "/@/utils/http/axios";


const urls = {
  getdata: '/gatewaySystemFdn/gatewaySystemFdn/getGatewayData',
  WarningList: '/gatewayWarning/gatewayWarning/list',
  warningCount: '/gatewayWarning/gatewayWarning/getWarningCount',
  warningHistortList: '/gatewayWarningHistory/gatewayWarningHistory/list',
  ShowIpInterface: '/gatewaySystemFdn/gatewaySystemFdn/showIpInterface',
  getIpInterfaceList: '/gatewaySystemFdn/gatewaySystemFdn/getIpInterfaceList',
  NetWorkFlowList: '/gatewaySystemFdn/gatewaySystemFdn/NetWorkFlowList',
  ringMonitorAir : "/ringMonitor/ringMonitor/conditioningData",
  ringMonitorupsData : "/ringMonitor/ringMonitor/upsData",
  ringWarninglist : "/j_monitoring/ringWarning/queryOnelist",
  ringWarningCount : "/j_monitoring/ringWarning/queryOneCount"
}
/**
 * 列表接口
 * @param params
 */
export const list = (Api, params) =>
  defHttp.post({ url: Api.list, params });


/**
* 获取空调实时数据
* @param params
*/
export const ringMonitorAir = (params) =>
  defHttp.get({ url: urls.ringMonitorAir, params });

/**
* 获取UPS实时数据
* @param params
*/
export const ringMonitorupsData = (params) =>
  defHttp.get({ url: urls.ringMonitorupsData, params });

/**
* 获取网关实时监测数据
* @param params
*/
export const getdataApi = (params) =>
  defHttp.get({ url: urls.getdata, params });


/**
* 获取当前预警信息
* @param params
*/
export const getWarningList = (params) =>
  defHttp.get({ url: urls.WarningList, params });


/**
 * 获取当前预警信息
 * @param params
 */
export const ringWarninglist = (params) =>
  defHttp.get({ url: urls.ringWarninglist, params });

/**
 * 获取当前预警总数
 * @param params
 */
export const getWarningCount = (params) =>
  defHttp.get({ url: urls.warningCount, params });

/**
 * 获取当前预警总数
 * @param params
 */
export const ringWarningCount = (params) =>
  defHttp.get({ url: urls.ringWarningCount, params });


/**
 * 获取当前预警总数
 * @param params
 */
export const getwarningHistortList = (params) =>
  defHttp.get({ url: urls.warningHistortList, params });

/**
* 获取当前网口信息
* @param params
*/
export const getShowIpInterface = (params) =>
  defHttp.get({ url: urls.ShowIpInterface, params });


/**
* 获取网络设备列表视图接口
* @param params
*/
export const getIpInterfaceList = (params) =>
  defHttp.get({ url: urls.getIpInterfaceList, params });



/**
 * 获取网络设备流量视图接口
 * @param params
 */
export const NetWorkFlowList = (params) =>
  defHttp.get({ url: urls.NetWorkFlowList, params });



/**
* 查看资源详情
* @param row
*/
export const getResourceInfo = row => {
  let url = "";
  switch (row.deviceType) {
    case '网络资源':
      url = '/j_monitoring/mGlNetworkResource/queryById';
      break;
    case '储存系统':
      url = '/j_monitoring/mGlStorageResources/queryById';
      break;
    case '控制器':
      url = '/j_monitoring/mGlRegulator/queryById';
      break;
    case '盘柜':
        url = '/j_monitoring/mGlDriveCabinet/queryById';
        break;
    case '安全设备':
      url = '/j_monitoring/mGlPeripheral/queryById';
      break;
    case '计算资源':
      url = '/j_monitoring/mGlComputingResource/queryById';
      break;
    case '其他设备':
      url = '/j_monitoring/mGlOtherItEquipment/queryById';
      break;
  }
  return defHttp.get({ url: url, params: { id: row.id } })
}
/**
 * 查看监控详情
 * @param row
 */
export const getMonitorInfo = row => {
  let type = 0;
  switch (row.deviceType) {
    case '网络资源':
      type = 1;
      break;
    case '储存资源':
      type = 4
      break;
    case '控制器':
      type = 3
      break;
    case '计算资源':
      type = 2;
      break;
  }

  return defHttp.get({
    url: "/gatewaySystemFdn/gatewaySystemFdn/getGatewayData", params: { id: row.id, type: type }
  })
}
